%%{init: {'themeVariables': { 'fontSize': '12px'}}}%%
graph TD
    classDef path fill:#eee,stroke:#000,color:#000
    classDef plan fill:#fff,stroke-width:1px,color:#000
    classDef itemplan fill:#fff,stroke-width:2px,color:#000
    classDef unbatchedplan fill:#dff,stroke-width:1px,color:#000
    classDef sideeffectplan fill:#fcc,stroke-width:2px,color:#000
    classDef bucket fill:#f6f6f6,color:#000,stroke-width:2px,text-align:left

    subgraph "Buckets for queries/v4/view"
    Bucket0("Bucket 0 (root)<br /><br />1: <br />ᐳ: Access[9], Access[10], Object[11]<br />2: PgSelect[8], PgSelect[15]<br />ᐳ: Access[29], Access[31]<br />3: Connection[12], Connection[17]<br />4: 19, 22"):::bucket
    Bucket1("Bucket 1 (nullableBoundary)<br />Deps: 12, 29, 19<br /><br />ROOT Connectionᐸ8ᐳ[12]"):::bucket
    Bucket2("Bucket 2 (nullableBoundary)<br />Deps: 17, 31, 22<br /><br />ROOT Connectionᐸ15ᐳ[17]"):::bucket
    Bucket5("Bucket 5 (listItem)<br />Deps: 29<br /><br />ROOT __Item{5}ᐸ19ᐳ[25]"):::bucket
    Bucket6("Bucket 6 (listItem)<br />Deps: 31<br /><br />ROOT __Item{6}ᐸ22ᐳ[27]"):::bucket
    Bucket7("Bucket 7 (nullableBoundary)<br />Deps: 25, 26, 30<br /><br />ROOT Edge{5}[26]"):::bucket
    Bucket8("Bucket 8 (nullableBoundary)<br />Deps: 27, 28, 32<br /><br />ROOT Edge{6}[28]"):::bucket
    Bucket9("Bucket 9 (nullableBoundary)<br />Deps: 33<br /><br />ROOT PgSelectSingle{7}ᐸtestviewᐳ[33]"):::bucket
    Bucket10("Bucket 10 (nullableBoundary)<br />Deps: 34<br /><br />ROOT PgSelectSingle{8}ᐸtestviewᐳ[34]"):::bucket
    end
    Bucket0 --> Bucket1 & Bucket2
    Bucket1 --> Bucket5
    Bucket2 --> Bucket6
    Bucket5 --> Bucket7
    Bucket6 --> Bucket8
    Bucket7 --> Bucket9
    Bucket8 --> Bucket10

    %% plan dependencies
    Object11{{"Object[11∈0] ➊<br />ᐸ{pgSettings,withPgClient}ᐳ"}}:::plan
    Access9{{"Access[9∈0] ➊<br />ᐸ2.pgSettingsᐳ"}}:::plan
    Access10{{"Access[10∈0] ➊<br />ᐸ2.withPgClientᐳ"}}:::plan
    Access9 & Access10 --> Object11
    PgSelect8[["PgSelect[8∈0] ➊<br />ᐸtestviewᐳ"]]:::plan
    Object11 --> PgSelect8
    __Value2["__Value[2∈0] ➊<br />ᐸcontextᐳ"]:::plan
    __Value2 --> Access9
    __Value2 --> Access10
    Connection12[["Connection[12∈0] ➊<br />ᐸ8ᐳ"]]:::plan
    PgSelect8 --> Connection12
    PgSelect15[["PgSelect[15∈0] ➊<br />ᐸtestviewᐳ"]]:::plan
    Object11 --> PgSelect15
    Connection17[["Connection[17∈0] ➊<br />ᐸ15ᐳ"]]:::plan
    PgSelect15 --> Connection17
    ConnectionItems19[["ConnectionItems[19∈0] ➊"]]:::plan
    Connection12 --> ConnectionItems19
    ConnectionItems22[["ConnectionItems[22∈0] ➊"]]:::plan
    Connection17 --> ConnectionItems22
    Access29{{"Access[29∈0] ➊<br />ᐸ8.cursorDetailsᐳ"}}:::plan
    PgSelect8 --> Access29
    Access31{{"Access[31∈0] ➊<br />ᐸ15.cursorDetailsᐳ"}}:::plan
    PgSelect15 --> Access31
    Edge26{{"Edge[26∈5]"}}:::plan
    __Item25[/"__Item[25∈5]<br />ᐸ19ᐳ"\]:::itemplan
    PgCursor30{{"PgCursor[30∈5]"}}:::plan
    __Item25 & PgCursor30 --> Edge26
    __Item25 & Access29 --> PgCursor30
    ConnectionItems19 ==> __Item25
    Edge28{{"Edge[28∈6]"}}:::plan
    __Item27[/"__Item[27∈6]<br />ᐸ22ᐳ"\]:::itemplan
    PgCursor32{{"PgCursor[32∈6]"}}:::plan
    __Item27 & PgCursor32 --> Edge28
    __Item27 & Access31 --> PgCursor32
    ConnectionItems22 ==> __Item27
    PgSelectSingle33{{"PgSelectSingle[33∈7]<br />ᐸtestviewᐳ"}}:::plan
    __Item25 --> PgSelectSingle33
    PgSelectSingle34{{"PgSelectSingle[34∈8]<br />ᐸtestviewᐳ"}}:::plan
    __Item27 --> PgSelectSingle34
    PgClassExpression35{{"PgClassExpression[35∈9]<br />ᐸ__testview...estviewid”ᐳ"}}:::plan
    PgSelectSingle33 --> PgClassExpression35
    PgClassExpression37{{"PgClassExpression[37∈9]<br />ᐸ__testview__.”col1”ᐳ"}}:::plan
    PgClassExpression35 o--o PgClassExpression37
    PgClassExpression39{{"PgClassExpression[39∈9]<br />ᐸ__testview__.”col2”ᐳ"}}:::plan
    PgClassExpression37 o--o PgClassExpression39
    PgClassExpression36{{"PgClassExpression[36∈10]<br />ᐸ__testview...estviewid”ᐳ"}}:::plan
    PgSelectSingle34 --> PgClassExpression36
    PgClassExpression38{{"PgClassExpression[38∈10]<br />ᐸ__testview__.”col1”ᐳ"}}:::plan
    PgClassExpression36 o--o PgClassExpression38
    PgClassExpression40{{"PgClassExpression[40∈10]<br />ᐸ__testview__.”col2”ᐳ"}}:::plan
    PgClassExpression38 o--o PgClassExpression40

    %% define steps
    classDef bucket0 stroke:#696969
    class Bucket0,__Value2,PgSelect8,Access9,Access10,Object11,Connection12,PgSelect15,Connection17,ConnectionItems19,ConnectionItems22,Access29,Access31 bucket0
    classDef bucket1 stroke:#00bfff
    class Bucket1 bucket1
    classDef bucket2 stroke:#7f007f
    class Bucket2 bucket2
    classDef bucket5 stroke:#7fff00
    class Bucket5,__Item25,Edge26,PgCursor30 bucket5
    classDef bucket6 stroke:#ff1493
    class Bucket6,__Item27,Edge28,PgCursor32 bucket6
    classDef bucket7 stroke:#808000
    class Bucket7,PgSelectSingle33 bucket7
    classDef bucket8 stroke:#dda0dd
    class Bucket8,PgSelectSingle34 bucket8
    classDef bucket9 stroke:#ff0000
    class Bucket9,PgClassExpression35,PgClassExpression37,PgClassExpression39 bucket9
    classDef bucket10 stroke:#ffff00
    class Bucket10,PgClassExpression36,PgClassExpression38,PgClassExpression40 bucket10

